package org.qingke.mail.item.service.provider;

import java.util.List;

import org.qingke.mail.common.SearchProperty;
import org.qingke.mail.common.ServerResponse;
import org.qingke.mail.domain.TbItem;
import org.qingke.mail.mapper.TbItemMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 商品服务提供实现
 * @author JAVA
 *
 */
@Service("itemServer")
public class ItemServiceProvider implements ItemService {
	
	@Autowired
	private TbItemMapper itemMapper;

	@Override
	public ServerResponse list(SearchProperty searchProperty) {
		
		ServerResponse serverResponse = ServerResponse.getInstance();
		List<TbItem> items =itemMapper.list(searchProperty);
		boolean state = null != items && items.size() > 0;
		if(state){
			serverResponse.setData(items);
			serverResponse.setState(true);
		}else{
			serverResponse.setState(true);
			serverResponse.setMessage("not data");
		}
		return serverResponse;
	}

}
